package com.litong.litongjiaoyu.service.impl;

import com.litong.litongjiaoyu.dao.WageDao;
import com.litong.litongjiaoyu.entity.UserWage;
import com.litong.litongjiaoyu.service.WageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @ClassName WageServiceImpl
 * @Description 工资中心业务具体实现
 * @Author jingz
 * @Date 2019/11/13 19:52
 * @Version 1.0
 **/
@Service
public class WageServiceImpl implements WageService {

    @Autowired
    private WageDao wageDao;


    /**
     * 添加工资条
     *
     * @param wage
     * @return int
     */
    @Transactional
    @Override
    public int add(UserWage wage) {
        return wageDao.add(wage);
    }

    /**
     * 更新工资条
     *
     * @param wage
     */
    @Transactional
    @Override
    public int update(UserWage wage) {
        return wageDao.update(wage);
    }

    /**
     * 获取全部
     *
     * @return List<UserWage>
     */
    @Override
    public List<UserWage> query() {
        return wageDao.query();
    }

    /**
     * 根据ID查询详情
     *
     * @param id
     * @return
     */
    @Override
    public UserWage getById(long id) {
        return wageDao.getById(id);
    }

    /**
     * 用于个人查询工资
     *
     * @param openid
     * @return
     */
    @Override
    public List<UserWage> getByOpenId(String openid) {
        return wageDao.getByOpenId(openid);
    }

    /**
     * 单个删除
     *
     * @param id
     * @return int
     */
    @Transactional
    @Override
    public int remove(long id) {
        return wageDao.remove(id);
    }

    /**
     * 批量删除
     *
     * @param id
     * @return int
     */
    @Transactional
    @Override
    public int batchRemove(long[] id) {
        return wageDao.batchRemove(id);
    }

    /**
     * 每月固定时间清空工资表
     *
     * @return
     */
    @Override
    public int deleteAll() {
        return wageDao.deleteAll();
    }
}
